package com.lxn.web.controller;


import com.lxn.doc.CourseDoc;
import com.lxn.hrm.util.AjaxResult;
import com.lxn.repository.CourseElasticsearchRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/es")
public class ESController {

    @Autowired
    private CourseElasticsearchRepository courseElasticsearchRepository;
    @PostMapping("/save")
    public AjaxResult save(@RequestBody CourseDoc courseDoc){
        courseElasticsearchRepository.save(courseDoc);
        return AjaxResult.me();
    }

    @DeleteMapping("/deleteById/{id}")
    public AjaxResult deleteById(@PathVariable("id")Long id){
        courseElasticsearchRepository.deleteById(id);
        return AjaxResult.me();
    }
}
